<p>This rule raises an issue when error parameters in <code>try/catch</code> blocks, <code>promise.catch()</code> handlers, or
<code>promise.then()</code> rejection handlers don’t follow the configured naming convention (defaults to <code>error</code>).</p>
<h2>Why is this an issue?</h2>
<p>Consistent naming of error parameters improves code readability and maintainability across your codebase. When developers use different names for
error parameters (<code>err</code>, <code>e</code>, <code>exception</code>, <code>badName</code>), it creates unnecessary cognitive overhead when
reading and maintaining code.</p>
<p>Consistent naming helps developers:</p>
<ul>
  <li> Quickly identify error handling code </li>
  <li> Understand the purpose of parameters at a glance </li>
  <li> Navigate codebases more efficiently </li>
  <li> Reduce mental context switching between different naming styles </li>
</ul>
<p>This rule applies to three common JavaScript error handling patterns:</p>
<ul>
  <li> Traditional <code>try/catch</code> blocks </li>
  <li> Promise <code>.catch()</code> methods </li>
  <li> Promise <code>.then()</code> rejection handlers (second parameter) </li>
</ul>
<p>The rule is flexible and allows descriptive names like <code>fsError</code> or <code>authError</code> when they provide meaningful context about
the type of error being handled.</p>
<h3>What is the potential impact?</h3>
<p>While this is primarily a code style issue, inconsistent error parameter naming can slow down development and code reviews. It may also make
debugging more difficult when developers need to quickly scan through error handling code.</p>
<h3>How to fix?</h3>
<p>Use the configured parameter name (defaults to <code>error</code>) for catch clause parameters.</p>
<h4>Non-compliant code example</h4>
<pre data-diff-id="1" data-diff-type="noncompliant">
try {
  riskyOperation();
} catch (badName) { // Noncompliant
  console.log(badName.message);
}
</pre>
<h4>Compliant code example</h4>
<pre data-diff-id="1" data-diff-type="compliant">
try {
  riskyOperation();
} catch (error) {
  console.log(error.message);
}
</pre>
<h3>Documentation</h3>
<ul>
  <li> <a href="https://github.com/sindresorhus/eslint-plugin-unicorn#readme">eslint-plugin-unicorn</a> - Rule <a
  href="https://github.com/sindresorhus/eslint-plugin-unicorn/blob/HEAD/docs/rules/catch-error-name.md">catch-error-name</a> </li>
  <li> MDN - try…​catch - <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try…​catch">Documentation for
  JavaScript try…​catch statements</a> </li>
  <li> MDN - Promise.prototype.catch() - <a
  href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch">Documentation for Promise catch method</a>
  </li>
  <li> ESLint - Configuring Rules - <a href="https://eslint.org/docs/latest/user-guide/configuring/rules">Guide on how to configure ESLint rules</a>
  </li>
</ul>
